<?php

namespace App\Http\Controllers\Admin;

use App\Admin\Stream;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Input;

class StreamController extends Controller
{
    /**
     * 直播流列表
     */
    public function index()
    {
        $data = Stream::orderBy('sort','desc')->get();
        return view('admin.stream.index',compact('data'));
    }

    public function add()
    {
        if(Input::method() == 'POST')
        {
            $data = Input::except('_token');
            $data['permited_at'] = strtotime($data['permited_at']);
            return Stream::insert($data)? '1' : '0';
        } else {
            return view('admin.stream.add');
        }
    }
}
